<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QAudioFormat Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QAudioFormat Class Reference<br /><sup><sup>[<a href="qtmultimedia.html">QtMultimedia</a> module]</sup></sup></h1><p>The QAudioFormat class stores audio parameter information.
<a href="#details">More...</a></p>

<h3>Types</h3><ul><li><div class="fn" />enum <b><a href="qaudioformat.html#Endian-enum">Endian</a></b> { BigEndian, LittleEndian }</li><li><div class="fn" />enum <b><a href="qaudioformat.html#SampleType-enum">SampleType</a></b> { Unknown, SignedInt, UnSignedInt, Float }</li></ul><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qaudioformat.html#QAudioFormat">__init__</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qaudioformat.html#QAudioFormat-2">__init__</a></b> (<i>self</i>, QAudioFormat&#160;<i>other</i>)</li><li><div class="fn" />Endian <b><a href="qaudioformat.html#byteOrder">byteOrder</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qaudioformat.html#channelCount">channelCount</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qaudioformat.html#channels">channels</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qaudioformat.html#codec">codec</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qaudioformat.html#frequency">frequency</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qaudioformat.html#isValid">isValid</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qaudioformat.html#sampleRate">sampleRate</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qaudioformat.html#sampleSize">sampleSize</a></b> (<i>self</i>)</li><li><div class="fn" />SampleType <b><a href="qaudioformat.html#sampleType">sampleType</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qaudioformat.html#setByteOrder">setByteOrder</a></b> (<i>self</i>, Endian&#160;<i>byteOrder</i>)</li><li><div class="fn" /><b><a href="qaudioformat.html#setChannelCount">setChannelCount</a></b> (<i>self</i>, int&#160;<i>channelCount</i>)</li><li><div class="fn" /><b><a href="qaudioformat.html#setChannels">setChannels</a></b> (<i>self</i>, int&#160;<i>channels</i>)</li><li><div class="fn" /><b><a href="qaudioformat.html#setCodec">setCodec</a></b> (<i>self</i>, QString&#160;<i>codec</i>)</li><li><div class="fn" /><b><a href="qaudioformat.html#setFrequency">setFrequency</a></b> (<i>self</i>, int&#160;<i>frequency</i>)</li><li><div class="fn" /><b><a href="qaudioformat.html#setSampleRate">setSampleRate</a></b> (<i>self</i>, int&#160;<i>sampleRate</i>)</li><li><div class="fn" /><b><a href="qaudioformat.html#setSampleSize">setSampleSize</a></b> (<i>self</i>, int&#160;<i>sampleSize</i>)</li><li><div class="fn" /><b><a href="qaudioformat.html#setSampleType">setSampleType</a></b> (<i>self</i>, SampleType&#160;<i>sampleType</i>)</li></ul><h3>Special Methods</h3><ul><li><div class="fn" />bool <b><a href="qaudioformat.html#__eq__">__eq__</a></b> (<i>self</i>, QAudioFormat&#160;<i>other</i>)</li><li><div class="fn" />bool <b><a href="qaudioformat.html#__ne__">__ne__</a></b> (<i>self</i>, QAudioFormat&#160;<i>other</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QAudioFormat class stores audio parameter information.</p>
<p>An audio format specifies how data in an audio stream is
arranged, i.e, how the stream is to be interpreted. The encoding
itself is specified by the <a href="qaudioformat.html#codec">codec</a>() used for the stream.</p>
<p>In addition to the encoding, QAudioFormat contains other
parameters that further specify how the audio data is arranged.
These are the frequency, the number of channels, the sample size,
the sample type, and the byte order. The following table describes
these in more detail.</p>
<table class="generic">
<thead>
<tr class="qt-style">
<th>Parameter</th>
<th>Description</th>
</tr>
</thead>
<tr class="odd" valign="top">
<td>Sample Rate</td>
<td>Samples per second of audio data in Hertz.</td>
</tr>
<tr class="even" valign="top">
<td>Number of channels</td>
<td>The number of audio channels (typically one for mono or two for
stereo)</td>
</tr>
<tr class="odd" valign="top">
<td>Sample size</td>
<td>How much data is stored in each sample (typically 8 or 16
bits)</td>
</tr>
<tr class="even" valign="top">
<td>Sample type</td>
<td>Numerical representation of sample (typically signed integer,
unsigned integer or float)</td>
</tr>
<tr class="odd" valign="top">
<td>Byte order</td>
<td>Byte ordering of sample (typically little endian, big
endian)</td>
</tr>
</table>
<p>You can obtain audio formats compatible with the audio device
used through functions in <a href="qaudiodeviceinfo.html">QAudioDeviceInfo</a>. This class also lets
you query available parameter values for a device, so that you can
set the parameters yourself. See the <a href="qaudiodeviceinfo.html">QAudioDeviceInfo</a> class description for
details. You need to know the format of the audio streams you wish
to play. Qt does not set up formats for you.</p>
<hr /><h2>Type Documentation</h2><h3 class="fn"><a name="Endian-enum" />QAudioFormat.Endian</h3><table class="valuelist">
<tr class="odd" valign="top">
<th class="tblConst">Constant</th>
<th class="tblval">Value</th>
<th class="tbldscr">Description</th>
</tr>
<tr>
<td class="topAlign"><tt>QAudioFormat.BigEndian</tt></td>
<td class="topAlign"><tt>QSysInfo.BigEndian</tt></td>
<td class="topAlign">samples are big endian byte order</td>
</tr>
<tr>
<td class="topAlign"><tt>QAudioFormat.LittleEndian</tt></td>
<td class="topAlign"><tt>QSysInfo.LittleEndian</tt></td>
<td class="topAlign">samples are little endian byte order</td>
</tr>
</table>


<h3 class="fn"><a name="SampleType-enum" />QAudioFormat.SampleType</h3><table class="valuelist">
<tr class="odd" valign="top">
<th class="tblConst">Constant</th>
<th class="tblval">Value</th>
<th class="tbldscr">Description</th>
</tr>
<tr>
<td class="topAlign"><tt>QAudioFormat.Unknown</tt></td>
<td class="topAlign"><tt>0</tt></td>
<td class="topAlign">Not Set</td>
</tr>
<tr>
<td class="topAlign"><tt>QAudioFormat.SignedInt</tt></td>
<td class="topAlign"><tt>1</tt></td>
<td class="topAlign">samples are signed integers</td>
</tr>
<tr>
<td class="topAlign"><tt>QAudioFormat.UnSignedInt</tt></td>
<td class="topAlign"><tt>2</tt></td>
<td class="topAlign">samples are unsigned intergers</td>
</tr>
<tr>
<td class="topAlign"><tt>QAudioFormat.Float</tt></td>
<td class="topAlign"><tt>3</tt></td>
<td class="topAlign">samples are floats</td>
</tr>
</table>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QAudioFormat" />QAudioFormat.__init__ (<i>self</i>)</h3><p>Construct a new audio format.</p>
<p>Values are initialized as follows:</p>
<ul>
<li><a href="qaudioformat.html#sampleRate">sampleRate</a>() =
-1</li>
<li><a href="qaudioformat.html#channelCount">channelCount</a>() =
-1</li>
<li><a href="qaudioformat.html#sampleSize">sampleSize</a>() =
-1</li>
<li><a href="qaudioformat.html#byteOrder">byteOrder</a>() =
<a href="qaudioformat.html#Endian-enum">QAudioFormat.Endian</a>(<a href="qsysinfo.html#Endian-enum">QSysInfo.ByteOrder</a>)</li>
<li><a href="qaudioformat.html#sampleType">sampleType</a>() =
<a href="qaudioformat.html#SampleType-enum">QAudioFormat.Unknown</a>
<tt>codec()</tt> = ""</li>
</ul>


<h3 class="fn"><a name="QAudioFormat-2" />QAudioFormat.__init__ (<i>self</i>, <a href="qaudioformat.html">QAudioFormat</a>&#160;<i>other</i>)</h3><p>Construct a new audio format using <i>other</i>.</p>


<h3 class="fn"><a name="byteOrder" /><a href="qaudioformat.html#Endian-enum">Endian</a> QAudioFormat.byteOrder (<i>self</i>)</h3><p>Returns the current byteOrder value.</p>
<p><b>See also</b> <a href="qaudioformat.html#setByteOrder">setByteOrder</a>().</p>


<h3 class="fn"><a name="channelCount" />int QAudioFormat.channelCount (<i>self</i>)</h3><p>Returns the current channel count value.</p>
<p>This function was introduced in Qt 4.7.</p>
<p><b>See also</b> <a href="qaudioformat.html#setChannelCount">setChannelCount</a>().</p>


<h3 class="fn"><a name="channels" />int QAudioFormat.channels (<i>self</i>)</h3><h3 class="fn"><a name="codec" />QString QAudioFormat.codec (<i>self</i>)</h3><p>Returns the current codec value.</p>
<p><b>See also</b> <a href="qaudioformat.html#setCodec">setCodec</a>() and <a href="qaudiodeviceinfo.html#supportedCodecs">QAudioDeviceInfo.supportedCodecs</a>().</p>


<h3 class="fn"><a name="frequency" />int QAudioFormat.frequency (<i>self</i>)</h3><h3 class="fn"><a name="isValid" />bool QAudioFormat.isValid (<i>self</i>)</h3><p>Returns true if all of the parameters are valid.</p>


<h3 class="fn"><a name="sampleRate" />int QAudioFormat.sampleRate (<i>self</i>)</h3><p>Returns the current sample rate in Hertz.</p>
<p>This function was introduced in Qt 4.7.</p>
<p><b>See also</b> <a href="qaudioformat.html#setSampleRate">setSampleRate</a>().</p>


<h3 class="fn"><a name="sampleSize" />int QAudioFormat.sampleSize (<i>self</i>)</h3><p>Returns the current sample size value.</p>
<p><b>See also</b> <a href="qaudioformat.html#setSampleSize">setSampleSize</a>().</p>


<h3 class="fn"><a name="sampleType" /><a href="qaudioformat.html#SampleType-enum">SampleType</a> QAudioFormat.sampleType (<i>self</i>)</h3><p>Returns the current <a href="qaudioformat.html#SampleType-enum">SampleType</a> value.</p>
<p><b>See also</b> <a href="qaudioformat.html#setSampleType">setSampleType</a>().</p>


<h3 class="fn"><a name="setByteOrder" />QAudioFormat.setByteOrder (<i>self</i>, <a href="qaudioformat.html#Endian-enum">Endian</a>&#160;<i>byteOrder</i>)</h3><p>Sets the byteOrder to <i>byteOrder</i>.</p>
<p><b>See also</b> <a href="qaudioformat.html#byteOrder">byteOrder</a>().</p>


<h3 class="fn"><a name="setChannelCount" />QAudioFormat.setChannelCount (<i>self</i>, int&#160;<i>channelCount</i>)</h3><p>Sets the channel count to <i>channels</i>.</p>
<p>This function was introduced in Qt 4.7.</p>
<p><b>See also</b> <a href="qaudioformat.html#channelCount">channelCount</a>().</p>


<h3 class="fn"><a name="setChannels" />QAudioFormat.setChannels (<i>self</i>, int&#160;<i>channels</i>)</h3><h3 class="fn"><a name="setCodec" />QAudioFormat.setCodec (<i>self</i>, QString&#160;<i>codec</i>)</h3><p>Sets the codec to <i>codec</i>.</p>
<p><b>See also</b> <a href="qaudioformat.html#codec">codec</a>()
and <a href="qaudiodeviceinfo.html#supportedCodecs">QAudioDeviceInfo.supportedCodecs</a>().</p>


<h3 class="fn"><a name="setFrequency" />QAudioFormat.setFrequency (<i>self</i>, int&#160;<i>frequency</i>)</h3><h3 class="fn"><a name="setSampleRate" />QAudioFormat.setSampleRate (<i>self</i>, int&#160;<i>sampleRate</i>)</h3><p>Sets the sample rate to <i>samplerate</i> Hertz.</p>
<p>This function was introduced in Qt 4.7.</p>
<p><b>See also</b> <a href="qaudioformat.html#sampleRate">sampleRate</a>().</p>


<h3 class="fn"><a name="setSampleSize" />QAudioFormat.setSampleSize (<i>self</i>, int&#160;<i>sampleSize</i>)</h3><p>Sets the sample size to the <i>sampleSize</i> specified.</p>
<p><b>See also</b> <a href="qaudioformat.html#sampleSize">sampleSize</a>().</p>


<h3 class="fn"><a name="setSampleType" />QAudioFormat.setSampleType (<i>self</i>, <a href="qaudioformat.html#SampleType-enum">SampleType</a>&#160;<i>sampleType</i>)</h3><p>Sets the sampleType to <i>sampleType</i>.</p>
<p><b>See also</b> <a href="qaudioformat.html#sampleType">sampleType</a>().</p>


<h3 class="fn"><a name="__eq__" />bool QAudioFormat.__eq__ (<i>self</i>, <a href="qaudioformat.html">QAudioFormat</a>&#160;<i>other</i>)</h3><h3 class="fn"><a name="__ne__" />bool QAudioFormat.__ne__ (<i>self</i>, <a href="qaudioformat.html">QAudioFormat</a>&#160;<i>other</i>)</h3><address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.9.1 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2011</td><td align="right" width="25%">Qt&#160;4.8.0</td></tr></table></div></address></body></html>